
<h1>News</h1>
<?php   
    // drafts
    if ( !empty($draft_list) )
    {
        $drafts = array();
        foreach($draft_list as $d)  {
            $drafts[] = link_to($d['title'],array('controller'=>'admin/news' ,'action'=>'modify?id='.$d['id']));
        }
        echo "<div class='section' style='background:#e9e9e9;margin:3px 0'><b>Your Drafts:</b><br>".implode(', ',$drafts)."</div>";
    }
    
    if ( has_access_to('News::Edit News') )
    {
        $report->set_action('edit',url_for(array('controller'=>'admin/news' ,'action'=>'modify')));
    }
    if ( has_access_to('News::Delete News') )
    {
        $report->set_action('delete',url_for(array('controller'=>'admin/news' ,'action'=>'delete')));
    }
    
    $table = $report->Render(15) ;

    if ( $report->total_rows == 0 )
    {
        echo '<div class="section" style=\'margin:5px 0\'>'.link_to('Create New Post',array('controller'=>'admin/news' ,'action'=>'modify')
        ).'</div>';
    } else {
?>

<?php include load_template('_news_search.php') ?>
<h2>Latest Posts</h2>
<?php        
        echo $table;
    }

?>